// 导入request
import http from "@utils/request";
import type { IRes } from "@interface";
import type { IUserInfo } from "@interface/user";

interface IInfo extends IRes {
  data: IUserInfo;
}

// 个人信息
export const getInfo = () => http.post<IInfo>("/xlx-sso/user/getInfo");

interface IloginReginfo extends IRes {
  data: string;
}
// 修改用户头像
export const loginReginfo = (data: File) =>
  http.post<IloginReginfo>("/xlx-sso/user/loginReginfo/head", data);

interface IsendCheckCode extends IRes {
  data: null;
}
// 修改密码-发送验证码验证身份
export const sendCheckCode = () =>
  http.post<IsendCheckCode>("/xlx-sso/user/sendCheckCode");

interface IModifyData extends IRes {
  data: string;
}
// 修改密码-验证码验证
export const modifyPasswordVerification = (verificationCode: string) =>
  http.post<IModifyData>("/xlx-sso/user/modifyPasswordVerification", {
    verificationCode,
  });

// 修改密码
export const modifyPassword = (password: string, repassword: string) =>
  http.post<IModifyData>("/xlx-sso/user/modifyPassword", {
    password,
    repassword,
  });

// 用户注销
export const userLogout = () => http.get<IModifyData>("/xlx-sso/user/logout");
